//
//  LBRemenCell.m
//  V-Learn
//
//  Created by Apple on 2019/1/24.
//  Copyright © 2019 yxk. All rights reserved.
//

#import "LBRemenCell.h"

@implementation LBRemenCell
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *identiffer = @"LBRemenCell";
    LBRemenCell *cell = [tableView dequeueReusableCellWithIdentifier:identiffer];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"LBRemenCell" owner:nil options:nil] firstObject];
        
    }
    return cell;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.descLab.text = @"dsaghaghahgasg";
//    self.followBtn.backgroundColor = rgb(233,84,18);
    self.followBtn.layer.cornerRadius = 12;
    self.followBtn.layer.masksToBounds = YES;
//    [self.zanBtn addTarget:self action:@selector(clickZanBtn:) forControlEvents:UIControlEventTouchUpInside];
    self.logo.layer.cornerRadius = 23.5;
    self.logo.layer.masksToBounds = YES;
    
//    self.followBtn.backgroundColor = rgb(233,84,18);
//    [self.followBtn setTitle:@"关注" forState:UIControlStateNormal];
//    [self.followBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
}
- (void)setModel:(WKHotmenModel *)model{
    _model = model;
    NSString *urlString = [NSString stringWithFormat:@"%@%@",Public_URL,model.headImg];
    [self.logo sd_setImageWithURL:[NSURL URLWithString:urlString] placeholderImage:[UIImage imageNamed:@"logo"]];
    self.timeLab.text = [model.clockDate substringToIndex:10];
    self.nameLab.text = model.username;
    self.titleLab.text = model.clockTitle;
    self.detailLab.text = model.clockOrtherTitle;
    if ([model.isAtten isEqualToString:@"1"]) {
        [self.followBtn setTitle:@"已关注" forState:UIControlStateNormal];
    }else{
        [self.followBtn setTitle:@"关注" forState:UIControlStateNormal];
    }
    if ([model.isPrase isEqualToString:@"1"]) {
        [self.zanBtn setImage:[UIImage imageNamed:@"wk_Fabulous"] forState:UIControlStateNormal];
    }else{
        [self.zanBtn setImage:[UIImage imageNamed:@"wk_unFabulous"] forState:UIControlStateNormal];
    }
    [self.zanBtn setTitle:model.praiseNum forState:UIControlStateNormal];
    
}
- (void)setFollowModel:(WKHotmenModel *)followModel{
    _followModel = followModel;
    NSString *urlString = [NSString stringWithFormat:@"%@%@",Public_URL,followModel.headImg];
    [self.logo sd_setImageWithURL:[NSURL URLWithString:urlString] placeholderImage:[UIImage imageNamed:@"logo"]];
    self.timeLab.text = [followModel.clockDate substringToIndex:10];
    self.nameLab.text = followModel.username;
    self.titleLab.text = followModel.clockTitle;
    self.detailLab.text = followModel.clockOrtherTitle;
    if (followModel.clockInfoVOList.count>0) {
        WKHotclockInfoVOListModel *model2 = followModel.clockInfoVOList[0];
//        self.descLab.text = model2.infoContent;
        self.descLab.text = @"test";
        self.descLab.backgroundColor = [UIColor cyanColor];
//        [self.descLab updateConstraints:^(MASConstraintMaker *make) {
//            make.left.mas_equalTo(15);
//            make.right.mas_equalTo(-15);
//            make.top.mas_equalTo(self.bigIcon.mas_bottom).mas_equalTo(8);
//        }];
        
    }
    if ([followModel.isPrase isEqualToString:@"1"]) {
        [self.zanBtn setImage:[UIImage imageNamed:@"wk_Fabulous"] forState:UIControlStateNormal];
    }else{
        [self.zanBtn setImage:[UIImage imageNamed:@"wk_unFabulous"] forState:UIControlStateNormal];
    }
    [self.zanBtn setTitle:followModel.praiseNum forState:UIControlStateNormal];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
